package org.derusse.cycle.model;

public class Tools
{
	public static String StringifyDistance(double distance)
	{
		if(distance<1000) return String.format("%.00f", distance)+" m";
		return String.format("%.01f", distance/1000)+" Km";
	}
	public static String StringifyAvg(double avg)
	{
		return String.format("%.02f", avg*3.6)+" Km/h";
	}
	public static String StringifyElaps(long start, long stop)
	{
		long elaps = stop-start;
		
		int seconds = (int) (elaps / 1000);
		int minutes = seconds / 60;
		int heures = minutes / 60;
		minutes = minutes % 60;
		seconds = seconds % 60;
		elaps = (elaps / 100) % 10;

		return String.format("%d:%02d:%02d.%01d", heures, minutes, seconds,
				elaps);
	}
}
